export VERSION=(curl -s https://api.github.com/repos/apecloud/kubeblocks/tags | jq -r '.[0].name')
# Replace <VERSION> with your selected version
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/${VERSION}/kubeblocks_crds.yaml


export namespace="kb-system"
export app_name="kubeblocks"
export repo="kubeblocks"
export helm="$repo/$app_name"
export url="https://apecloud.github.io/helm-charts"
# export url='https://jihulab.com/api/v4/projects/85949/packages/helm/stable/'
helm repo remove $repo
helm repo add $repo $url
helm repo update $repo

# helm search repo kubeblocks --devel --versions

helm upgrade $app_name $helm --create-namespace --install \
    -n $namespace --version=${VERSION}

## curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
## kbcli completion fish
## kbcli kubeblocks install
